using System;
using GoldDigger.Models;
using GoldDigger.Sprites;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace GoldDigger.Screens
{
    internal class MainMenuScreen : MenuScreen
    {
        public override void LoadContent()
        {
            // Common font
            var font = ScreenManager.Game.Content.Load<SpriteFont>(@"Fonts/MenuFont");

            Func<string, MenuEntry> createEntry =
                s => new MenuEntry(s)
                         {
                             Font = font,
                             Color = Color.Gold
                         };

            // Create our menu entries.
            MenuEntry startGameMenuEntry = createEntry("Start game");
            MenuEntry exitMenuEntry = createEntry("Quit");
            // Load first scene
            const int startlevel = 6;
            const int totalvalue = 20000;
            Scene firstScene = ScreenManager.Game.Content.Load<Scene>(@"Scenes/scene" + startlevel);
            // Hook up menu event handlers.
            startGameMenuEntry.Tapped += (s, e) => ScreenManager.AddScreen(new WelcomeScreen(firstScene, totalvalue, startlevel));
            exitMenuEntry.Tapped += (s, e) => ScreenManager.Game.Exit();

            // Register sprites
            AddSprite(startGameMenuEntry);
            AddSprite(exitMenuEntry);
            
            base.LoadContent();
        }
    }
}
